import java.util.Scanner;

public class Test {
    public static void move(char pos1, char pos2) {
        System.out.println(pos1+" -> "+pos2+" ");
    }



    public static void hanoi(int n, char pos1 ,char pos2, char pos3) {
        if(n == 1) {
            move(pos1 , pos3);
            return;
        }
        hanoi(n - 1, pos1, pos3, pos2);
        move(pos1, pos3);
        hanoi(n - 1,pos2 ,pos1, pos3);
    }


    public static void main(String[] args) {
        //输入有几层汉诺塔
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();

        hanoi(n,'A','B','C');

        //测试输入是否正确
        //System.out.println(n);

    }
}
